# coding:utf-8

import pymysql

db = pymysql.connect("localhost","root","boyun2017","py_mysql")
cursor = db.cursor()
sql = """DELETE FROM employee WHERE age > %d""" % 25

try:
    cursor.execute(sql)
    db.commit()
except:
    db.rollback()

db.close()